package com.zht.controller;

import com.zht.model.Mail;
import com.zht.service.MailService;
import com.zht.util.ApiResponse;
import jakarta.annotation.Resource;
import jakarta.validation.Valid;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@Slf4j
@RequestMapping("/mail")
public class SendMailController {

    @Resource
    private MailService mailService;

    @PostMapping("/sendSampleMail")
    public ApiResponse sendSampleMail(@Valid @RequestBody Mail mail){
        ApiResponse rs = mailService.sendSimpleMail(mail);
        return rs;
    }

    @PostMapping("/sendHtmlMail")
    public ApiResponse sendHTMLMail(@Valid @RequestBody Mail mail){
        ApiResponse rs = mailService.sendHTMLMail(mail);
        return rs;
    }
}
